package com.hst.capacity.facade.rest;

import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSON;
import com.hst.capacity.application.fence.biz.FenceBiz;
import com.hst.capacity.application.biz.SettingBiz;
import com.hst.capacity.domain.exception.BusinessException;
import com.hst.capacity.domain.model.request.fence.FenceAddParam;
import com.hst.capacity.domain.model.request.fence.FenceListParam;
import com.hst.capacity.domain.model.request.setting.franchisee.OrderPoolSwicthParam;
import com.hst.capacity.domain.model.request.setting.franchisee.VirtualDriverParam;
import com.hst.capacity.domain.model.request.setting.price.*;
import com.hst.capacity.domain.model.response.DefaultVO;
import com.hst.capacity.infra.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.HashMap;
import java.util.Map;

import static com.hst.capacity.domain.model.response.DefaultVO.success;

/**
 *  配置中心-定价中心模块 Controller
 *
 * */
@Slf4j
@RequestMapping("/setting")
@RestController
public class SettingController {

    @Autowired
    private SettingBiz settingBiz;

    @Autowired
    private FenceBiz fenceBiz;

    /**
     * 创建司机信息
     *
     * @param param
     * @return
     */
    @PostMapping("/user/pwd/convert")
    private DefaultVO userSave(@RequestBody Map<String,String> param) {
        String pwd = param.get("pwd");
        if (StrUtil.isEmpty(pwd))
            throw new BusinessException(4001,"参数不能为空");
        return success(settingBiz.convertPwd(pwd));
    }

    @PostMapping("/fence/save")
    private DefaultVO save(@RequestBody @Valid FenceAddParam param) {
        return success(fenceBiz.save(param));
    }

    //list
    @PostMapping("/fence/search")
    private DefaultVO search(@RequestBody @Valid FenceListParam param) {
        return success(fenceBiz.search(param));
    }

    //list
    @PostMapping("/fence/list/search")
    private DefaultVO searchList(@RequestBody @Valid FenceListParam param) {
        return success(fenceBiz.searchList(param));
    }

    /**
     * 普通快车价格列表
     * @param param
     * @return
     */
    @RequestMapping ("/price/new/express/search")
    public DefaultVO newExpressSearch(@RequestBody @Valid SearchParam param){
        return success(settingBiz.newExpressSearch(param));
    }

    /**
     * 普通快车价格列表
     * @param param
     * @return
     */
    @RequestMapping ("/price/express/search")
    public DefaultVO expressSearch(@RequestBody @Valid SearchParam param){
        return success(settingBiz.expressSearch(param));
    }

    /**
     * 站点驳车价格列表
     * @param param
     * @return
     */
    @RequestMapping ("/price/express/stp/search")
    public DefaultVO expressStpSearch(@RequestBody @Valid SearchParam param){
        return success(settingBiz.expressStpSearch(param));
    }

    /**
     * 城际价格列表
     * @param param
     * @return
     */
    @RequestMapping ("/price/intercity/search")
    public DefaultVO intercitySearch(@RequestBody @Valid SearchParam param){
        return success(settingBiz.intercitySearch(param));
    }

    /**
     * 专车价格列表
     * @param param
     * @return
     */
    @RequestMapping ("/price/special/search")
    public DefaultVO specialCarSearch(@RequestBody @Valid SearchParam param){
        return success(settingBiz.specialCarSearch(param));
    }

    /**
     * 机场价格列表
     * @param param
     * @return
     */
    @RequestMapping ("/price/airport/search")
    public DefaultVO airportSearch(@RequestBody @Valid SearchParam param){
        return success(settingBiz.airportSearch(param));
    }

    /**
     * 高铁站价格列表
     * @param param
     * @return
     */
    @RequestMapping ("/price/railway/search")
    public DefaultVO railwaySearch(@RequestBody @Valid SearchParam param){
        return success(settingBiz.railwayStationSearch(param));
    }

    /**
     * 接送机价格列表
     * @param param
     * @return
     */
    @RequestMapping ("/price/v2/airport/search")
    public DefaultVO newAirportSearch(@RequestBody @Valid SearchParam param){
        return success(settingBiz.newAirportSearch(param));
    }

    /**
     * 接送机价格列表
     * @param param
     * @return
     */
    @RequestMapping ("/price/airport/common/search")
    public DefaultVO airportCommonSearch(@RequestBody@Valid SearchParam param){
        return success(settingBiz.airportCommonSearch(param));
    }

    /**
     * 接送站价格列表
     * @param param
     * @return
     */
    @RequestMapping ("/price/station/search")
    public DefaultVO stationSearch(@RequestBody@Valid SearchParam param){
        return success(settingBiz.stationSearch(param));
    }

    /**
     * 接送站价格列表
     * @param param
     * @return
     */
    @RequestMapping ("/price/station/common/search")
    public DefaultVO stationCommonSearch(@RequestBody@Valid SearchParam param){
        return success(settingBiz.stationCommonSearch(param));
    }

    /**
     * 城际价格细节
     * @param param
     * @return
     */
    @RequestMapping ("/price/intercity/detail")
    public DefaultVO intercityPrice(@RequestBody @Valid Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        return success(settingBiz.intercityPrice(idPrice));
    }

    /**
     * 城际线路价格细节
     * @param param
     * @return
     */
    @RequestMapping ("/price/intercity/idline")
    public DefaultVO intercityPriceByIdline(@RequestBody @Valid Map<String,String> param){
        String idLine = param.get("idLine");
        if (StrUtil.isEmpty(idLine))
            throw new BusinessException(4001,"线路ID[idLine]不能为空");
        return success(settingBiz.intercityPriceByIdline(idLine));
    }

    /**
     * 普通快车价格细节
     * @param param
     * @return
     */
    @RequestMapping ("/price/new/express/detail")
    public DefaultVO newExpressPrice(@RequestBody @Valid Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        return success(settingBiz.newExpressPrice(idPrice));
    }

    /**
     * 新快车加价
     * @param param
     * @return
     */
    @RequestMapping ("/price/new/express/markup")
    public DefaultVO newExpressMarkup(@RequestBody @Valid Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        HashMap<String, String> result = new HashMap<>();
        result.put("idPrice", idPrice);
        result.put("markupPriceSetting", settingBiz.newExpressMarkup(idPrice));
        return success(result);
    }

    /**
     * 新快车加价保存
     * @param param
     * @return
     */
    @RequestMapping ("/price/new/express/markup/save")
    public DefaultVO newExpressMarkupSave(@RequestBody @Valid Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001, "价格ID[idPrice]不能为空");
        String markup = param.get("markupPriceSetting");
        if (StringUtil.isNotBlank(markup)) {
            if (JSON.isValid(markup))
                throw new BusinessException(4001, "加价围栏[markupPriceSetting]数据格式不对，不为JSON格式");
        }
        return success(settingBiz.newExpressMarkupSave(idPrice, markup));
    }

    /**
     * 普通快车价格细节
     * @param param
     * @return
     */
    @RequestMapping ("/price/express/detail")
    public DefaultVO expressPrice(@RequestBody @Valid Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        return success(settingBiz.expressPrice(idPrice));
    }

    /**
     * 站点驳车价格细节
     * @param param
     * @return
     */
    @RequestMapping ("/price/express/stp/detail")
    public DefaultVO expressStpPrice(@RequestBody @Valid Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        return success(settingBiz.expressStpPrice(idPrice));
    }

    /**
     * 专车价格细节
     * @param param
     * @return
     */
    @RequestMapping ("/price/special/detail")
    public DefaultVO specialCarPrice(@RequestBody @Valid Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        return success(settingBiz.specialCarPrice(idPrice));
    }

    /**
     * 机场价格详细
     * @param param
     * @return
     */
    @RequestMapping ("/price/airport/detail")
    public DefaultVO airportDetail(@RequestBody Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        return success(settingBiz.airportPrice(idPrice));
    }

    /**
     * 高铁站价格详细
     * @param param
     * @return
     */
    @RequestMapping ("/price/railway/detail")
    public DefaultVO railwayDetail(@RequestBody Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        return success(settingBiz.railwayStationPrice(idPrice));
    }

    /**
     * 新的机场价格详细
     * @param param
     * @return
     */
    @RequestMapping ("/price/v2/airport/detail")
    public DefaultVO newAirportDetail(@RequestBody Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        return success(settingBiz.newAirportPrice(idPrice));
    }

    /**
     * 接送机加价
     * @param param
     * @return
     */
    @RequestMapping ("/price/v2/airport/markup")
    public DefaultVO newAirportMarkup(@RequestBody @Valid Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        HashMap<String, String> result = new HashMap<>();
        result.put("idPrice", idPrice);
        result.put("markupPriceSetting", settingBiz.newAirportMarkup(idPrice));
        return success(result);
    }

    /**
     * 接送机加价保存
     * @param param
     * @return
     */
    @RequestMapping ("/price/v2/airport/markup/save")
    public DefaultVO newAirportMarkupSave(@RequestBody @Valid Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        String markup = param.get("markupPriceSetting");
        if (StringUtil.isNotBlank(markup)) {
            if (JSON.isValid(markup))
                throw new BusinessException(4001, "加价围栏[markupPriceSetting]数据格式不对，不为JSON格式");
        }
        return success(settingBiz.newAirportMarkupSave(idPrice, markup));
    }

    /**
     * 机场（通用）价格详细
     * @param param
     * @return
     */
    @RequestMapping ("/price/airport/common/detail")
    public DefaultVO airportCommonDetail(@RequestBody Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        return success(settingBiz.airportCommonDetail(idPrice));
    }

    /**
     * 机场（通用）加价
     * @param param
     * @return
     */
    @RequestMapping ("/price/airport/common/markup")
    public DefaultVO airportCommonMarkup(@RequestBody @Valid Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        HashMap<String, String> result = new HashMap<>();
        result.put("idPrice", idPrice);
        result.put("markupPriceSetting", settingBiz.airportCommonMarkup(idPrice));
        return success(result);
    }

    /**
     * 机场（通用）加价保存
     * @param param
     * @return
     */
    @RequestMapping ("/price/airport/common/markup/save")
    public DefaultVO airportCommonMarkupSave(@RequestBody @Valid Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001, "价格ID[idPrice]不能为空");
        String markup = param.get("markupPriceSetting");
        if (StringUtil.isNotBlank(markup)) {
            if (JSON.isValid(markup))
                throw new BusinessException(4001, "加价围栏[markupPriceSetting]数据格式不对，不为JSON格式");
        }
        return success(settingBiz.airportCommonMarkupSave(idPrice, markup));
    }

    /**
     * 高铁站价格详细
     * @param param
     * @return
     */
    @RequestMapping ("/price/station/detail")
    public DefaultVO stationDetail(@RequestBody Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        return success(settingBiz.newStationPrice(idPrice));
    }

    /**
     * 高铁站加价
     * @param param
     * @return
     */
    @RequestMapping ("/price/station/markup")
    public DefaultVO stationMarkup(@RequestBody @Valid Map<String,String> param) {
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        HashMap<String, String> result = new HashMap<>();
        result.put("idPrice", idPrice);
        result.put("markupPriceSetting", settingBiz.newStationMarkup(idPrice));
        return success(result);
    }

    /**
     * 高铁站加价保存
     * @param param
     * @return
     */
    @RequestMapping ("/price/station/markup/save")
    public DefaultVO stationMarkupSave(@RequestBody @Valid Map<String,String> param) {
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        String markup = param.get("markupPriceSetting");
        if (StringUtil.isNotBlank(markup)) {
            if (JSON.isValid(markup))
                throw new BusinessException(4001, "加价围栏[markupPriceSetting]数据格式不对，不为JSON格式");
        }
        return success(settingBiz.newStationMarkupSave(idPrice, markup));
    }

    /**
     * 高铁站（通用）价格详细
     * @param param
     * @return
     */
    @RequestMapping ("/price/station/common/detail")
    public DefaultVO stationCommonDetail(@RequestBody Map<String,String> param) {
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        return success(settingBiz.stationCommonDetail(idPrice));
    }

    /**
     * 高铁站（通用）加价
     * @param param
     * @return
     */
    @RequestMapping ("/price/station/common/markup")
    public DefaultVO stationCommonMarkup(@RequestBody @Valid Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        HashMap<String, String> result = new HashMap<>();
        result.put("idPrice", idPrice);
        result.put("markupPriceSetting", settingBiz.stationCommonMarkup(idPrice));
        return success(result);
    }

    /**
     * 高铁站（通用）加价保存
     * @param param
     * @return
     */
    @RequestMapping ("/price/station/common/markup/save")
    public DefaultVO stationCommonMarkupSave(@RequestBody @Valid Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001, "价格ID[idPrice]不能为空");
        String markup = param.get("markupPriceSetting");
        if (StringUtil.isNotBlank(markup)) {
            if (JSON.isValid(markup))
                throw new BusinessException(4001, "加价围栏[markupPriceSetting]数据格式不对，不为JSON格式");
        }
        return success(settingBiz.stationCommonMarkupSave(idPrice, markup));
    }

    /**
     * 普通快车添加/保存定价
     * @param param
     * @return
     */
    @RequestMapping ("/price/new/express/save")
    public DefaultVO newExpressSave(@RequestBody@Valid NewExSaveParam param){
        return success(MapUtil.builder("idServicePriceType", settingBiz.newExpressSave(param)).build());
    }

    /**
     * 普通快车添加/保存定价
     * @param param
     * @return
     */
    @RequestMapping ("/price/express/save")
    public DefaultVO expressSave(@RequestBody@Valid ExSaveParam param){
        return success(MapUtil.builder("idServicePriceType", settingBiz.expressSave(param)).build());
    }

    /**
     * 站点驳车添加/保存定价
     * @param param
     * @return
     */
    @RequestMapping ("/price/express/stp/save")
    public DefaultVO expressStpSave(@RequestBody@Valid StpSaveParam param){
        return success(MapUtil.builder("idServicePriceType", settingBiz.expressStpSave(param)).build());
    }

    /**
     * 城际添加/保存定价
     * @param param
     * @return
     */
    @RequestMapping ("/price/intercity/stp/save")
    public DefaultVO intercitySave(@RequestBody@Valid IcSaveParam param){
        return success(MapUtil.builder("idIntercityLinePrice", settingBiz.intercitySave(param)).build());
    }

    /**
     * 专车添加/保存定价
     * @param param
     * @return
     */
    @RequestMapping ("/price/special/save")
    public DefaultVO specialCarSave(@RequestBody@Valid SpSaveParam param){
        return success(MapUtil.builder("idServicePriceType", settingBiz.specialCarSave(param)).build());
    }

    /**
     * 接送机定价
     * @param param
     * @return
     */
    @RequestMapping ("/price/airport/save")
    public DefaultVO airportSave(@RequestBody@Valid NewApParam param){
        return success(MapUtil.builder("idServicePriceType", settingBiz.airportSave(param)).build());
    }

    /**
     * 接送机定价
     * @param param
     * @return
     */
    @RequestMapping ("/price/airport/common/save")
    public DefaultVO airportCommonSave(@RequestBody@Valid ApCommonParam param){
        return success(MapUtil.builder("idServicePriceType", settingBiz.airportCommonSave(param)).build());
    }

    /**
     * 接送站定价
     * @param param
     * @return
     */
    @RequestMapping ("/price/station/save")
    public DefaultVO stationSave(@RequestBody@Valid NewStParam param){
        return success(MapUtil.builder("idServicePriceType", settingBiz.stationSave(param)).build());
    }

    /**
     * 接送站定价
     * @param param
     * @return
     */
    @RequestMapping ("/price/station/common/save")
    public DefaultVO stationCommonSave(@RequestBody@Valid StCommonParam param){
        return success(MapUtil.builder("idServicePriceType", settingBiz.stationCommonSave(param)).build());
    }

    /**
     * 接送机定价状态开关(启用/禁用)
     * @param param
     * @return
     */
    @RequestMapping ("/price/new/express/status")
    public DefaultVO newExpressStatus(@RequestBody@Valid Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StringUtil.isBlank(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");

        String status = param.get("status");
        if (StringUtil.isBlank(status))
            throw new BusinessException(4001,"状态[status]不能为空");
        return success(MapUtil.builder("idServicePriceType", settingBiz.newExpressStatus(idPrice, status)).build());
    }

    /**
     * 接送机定价状态开关(启用/禁用)
     * @param param
     * @return
     */
    @RequestMapping ("/price/airport/status")
    public DefaultVO airportStatus(@RequestBody@Valid Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StringUtil.isBlank(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");

        String status = param.get("status");
        if (StringUtil.isBlank(status))
            throw new BusinessException(4001,"状态[status]不能为空");
        return success(MapUtil.builder("idServicePriceType", settingBiz.airportStatus(idPrice, status)).build());
    }

    /**
     * 接送机定价状态开关(启用/禁用)
     * @param param
     * @return
     */
    @RequestMapping ("/price/airport/common/status")
    public DefaultVO airportCommonStatus(@RequestBody@Valid Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StringUtil.isBlank(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");

        String status = param.get("status");
        if (StringUtil.isBlank(status))
            throw new BusinessException(4001,"状态[status]不能为空");
        return success(MapUtil.builder("idServicePriceType", settingBiz.airportCommonStatus(idPrice, status)).build());
    }

    /**
     * 接送站定价状态开关(启用/禁用)
     * @param param
     * @return
     */
    @RequestMapping ("/price/station/status")
    public DefaultVO stationStatus(@RequestBody@Valid Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StringUtil.isBlank(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");

        String status = param.get("status");
        if (StringUtil.isBlank(status))
            throw new BusinessException(4001,"状态[status]不能为空");
        return success(MapUtil.builder("idServicePriceType", settingBiz.stationStatus(idPrice, status)).build());
    }

    /**
     * 接送站定价状态开关(启用/禁用)
     * @param param
     * @return
     */
    @RequestMapping ("/price/station/common/status")
    public DefaultVO stationCommonStatus(@RequestBody@Valid Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StringUtil.isBlank(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");

        String status = param.get("status");
        if (StringUtil.isBlank(status))
            throw new BusinessException(4001,"状态[status]不能为空");
        return success(MapUtil.builder("idServicePriceType", settingBiz.stationCommonStatus(idPrice, status)).build());
    }

    /**
     * 快车查询单条/编辑查询
     * @param param
     * @return
     */
    @RequestMapping ("/price/express/select")
    public DefaultVO expressSelect(@RequestBody Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        return success(settingBiz.expressSelect(idPrice));
    }

    /**
     * 站点驳车查询单条/编辑查询
     * @param param
     * @return
     */
    @RequestMapping ("/price/express/stp/select")
    public DefaultVO expressStpSelect(@RequestBody Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        return success(settingBiz.expressStpSelect(idPrice));
    }

    /**
     * 城际查询单条/编辑查询
     * @param param
     * @return
     */
    @RequestMapping ("/price/intercity/select")
    public DefaultVO intercitySelect(@RequestBody Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        return success(settingBiz.intercitySelect(idPrice));
    }

    /**
     * 专车查询单条/编辑查询
     * @param param
     * @return
     */
    @RequestMapping ("/price/special/select")
    public DefaultVO specialCarSelect(@RequestBody Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        return success(settingBiz.specialCarSelect(idPrice));
    }

//    /**
//     * 机场查询单条/编辑查询
//     * @param param
//     * @return
//     */
//    @RequestMapping ("/airport/select")
//    public DefaultVO airportSelect(@RequestBody Map<String,String> param){
//        String idPrice = param.get("idPrice");
//        if (StrUtil.isEmpty(idPrice))
//            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
//        return success(settingPriceBiz.specialCarSelect(idPrice));
//    }

    /**
     * 高铁站查询单条/编辑查询
     * @param param
     * @return
     */
    @RequestMapping ("/price/railway/select")
    public DefaultVO railwaySelect(@RequestBody Map<String,String> param){
        String idPrice = param.get("idPrice");
        if (StrUtil.isEmpty(idPrice))
            throw new BusinessException(4001,"价格ID[idPrice]不能为空");
        return success(settingBiz.specialCarSelect(idPrice));
    }

    /**
     * 专车溢价设置查询
     * @param param
     * @return
     */
    @RequestMapping ("/sp/all/premium/price/select")
    public DefaultVO spAllPremiumPriceSelect(@RequestBody SpPremiumPriceParam param){
        log.info("SpPremiumPriceParam :{}", JSON.toJSONString(param));
        if (StringUtil.isBlank(param.getIdPrice()) && StringUtil.isBlank(param.getIdFranchisee()))
            throw new BusinessException(4001,"必要参数不能为空");
        return success(settingBiz.spAllPremiumPriceSelect(param));
    }

    /**
     * 专车溢价设置查询
     * @param param
     * @return
     */
    @RequestMapping ("/sp/premium/price/select")
    public DefaultVO spPremiumPriceSelect(@RequestBody SpPremiumPriceParam param){
        if (StringUtil.isBlank(param.getIdPrice()) && StringUtil.isBlank(param.getIdFranchisee()))
            throw new BusinessException(4001,"必要参数不能为空");
        HashMap<String,Object> result = new HashMap<>();
        result.put("list", settingBiz.spPremiumPriceSelect(param));
        return success(result);
    }

    /**
     * 专车溢价设置明细
     * @param param
     * @return
     */
    @RequestMapping ("/sp/premium/price/detail")
    public DefaultVO spPremiumPriceDetail(@RequestBody Map<String,String> param){
        String idPremiumPrice = param.get("idPremiumPrice");
        if (StringUtil.isBlank(idPremiumPrice))
            throw new BusinessException(4001,"主键ID[idPremiumPrice]不能为空");
        return success(settingBiz.spPremiumPriceDetail(idPremiumPrice));
    }

    /**
     * 专车溢价设置保存
     * @param param
     * @return
     */
    @RequestMapping ("/sp/premium/price/save")
    public DefaultVO spPremiumPriceSave(@RequestBody SpPremiumPriceParam param){
        log.info("SpPremiumPriceParam :{}", JSON.toJSONString(param));
        return success(settingBiz.spPremiumPriceSave(param));
    }

    /**
     * 订单池开关列表
     * @param param
     * @return
     */
    @PostMapping("/order-pool/swicth/select")
    private DefaultVO orderPoolSwicthSelect(@RequestBody @Valid OrderPoolSwicthParam param){
        HashMap<String,Object> result = new HashMap<>();
        result.put("list", settingBiz.orderPoolSwicthSelect(param));
        return success(result);
    }

    /**
     * 订单池开关列表
     * @param param
     * @return
     */
    @PostMapping("/order-pool/swicth/save")
    private DefaultVO orderPoolSwicthSave(@RequestBody @Valid OrderPoolSwicthParam param){
        return success(MapUtil.builder("idOrderPoolSwicth",settingBiz.orderPoolSwicthSave(param)).build());
    }

    /**
     * 虚拟司机查询
     * @param param
     * @return
     */
    @RequestMapping ("/virtual/driver/select")
    public DefaultVO virtualDriverLst(@RequestBody VirtualDriverParam param){
        HashMap<String,Object> result = new HashMap<>();
        result.put("list", settingBiz.virtualDriverLst(param));
        return success(result);
    }

    /**
     * 虚拟司机查询
     * @param param
     * @return
     */
    @RequestMapping ("/virtual/driver/detail")
    public DefaultVO virtualDriverDetail(@RequestBody VirtualDriverParam param){
        return success(settingBiz.virtualDriverInfo(param.getIdVirtualDriver()));
    }

    /**
     * 虚拟司机保存
     * @param param
     * @return
     */
    @RequestMapping ("/virtual/driver/save")
    public DefaultVO virtualDriverSave(@RequestBody VirtualDriverParam param){
        return success(settingBiz.virtualDriverSave(param));
    }

}
